<?php

namespace App\Services\ApplyGoldRecordContact;

use App\Models\User;
use Illuminate\Support\Facades\Redis;
use App\Jobs\ContactGoldProductJob;

use Rainsens\Dinglog\Facades\Dinglog;

class ApplyGoldRecordContact
{
	protected User $user;

	protected $unpaidCacheId = '';

	public function __construct(User $user, $unpaidCacheId)
	{
		$this->user = $user;
		$this->unpaidCacheId = $unpaidCacheId;
	}

	public function upload()
	{
		if (!$this->unpaidCacheId) return;
        $this->user->contactRecord($this->unpaidCacheId);
        $queue = app()->environment('local') ? 'default' : 'default';
        dispatch(new ContactGoldProductJob($this->user, $this->unpaidCacheId))->onQueue($queue);
		
	}
}
